import storage from './storage'
import message from './message'
import dayjs from 'dayjs'
import constants from './consts'
import bus from './bus'
import Dict from './system.dict'
import getConfigValue from './system.config'
import { useDefaultStore } from '@/core/store'
export default {
  install (app) {
    // 常量
    app.config.globalProperties.$consts = constants
    // 数据存储
    app.config.globalProperties.$storage = storage
    // 消息提示
    app.config.globalProperties.$tip = message
    // 事件总线
    app.config.globalProperties.$bus = bus
    // dayjs
    app.config.globalProperties.$dayjs = dayjs
    // 获取配置值方法
    app.config.globalProperties.$c = getConfigValue
    // 获取字典标签方法
    app.config.globalProperties.$d = Dict.getDictLabel
    // 获取字典配置方法
    app.config.globalProperties.$dc = Dict.getDictConfig
    // 默认store
    app.config.globalProperties.$defaultStore = useDefaultStore()
    // 跳转
    app.config.globalProperties.navigateTo = function (url, config={}) {
      uni.navigateTo({
        url: url,
        ...config
      })
    }
  }
}
